import 'package:flutter/material.dart';
import 'package:get/get.dart';
import 'package:ws2812_time/command/esp8266_iot.dart';

class PowerLogic extends GetxController {
  Rx<Color> screenPickerColor = Rx<Color>(Colors.cyan);
  RxBool ledIsOFF = RxBool(false);
  RxDouble brightness = RxDouble(0);

  @override
  void onInit() {
    super.onInit();
    // 防抖 1 秒内
    debounce(
      screenPickerColor,
      (value) {
        ESP8266.setColor(screenPickerColor.value);
        debugPrint("更新颜色->${screenPickerColor.value.hashCode}");
      },
      time: const Duration(seconds: 1),
    );
  }
}
